package com.sghd.fight.module.game.config;

import javax.persistence.Embeddable;
import java.io.Serializable;

@Embeddable
public class LevelId  implements Serializable,Comparable<LevelId>{

    private Integer bigLevelId;

    private Integer levelId;

    public LevelId() {
    }

    public LevelId(Integer bigLevelId, Integer levelId) {
        this.bigLevelId = bigLevelId;
        this.levelId = levelId;
    }

    public Integer getBigLevelId() {
        return bigLevelId;
    }

    public void setBigLevelId(Integer bigLevelId) {
        this.bigLevelId = bigLevelId;
    }

    public Integer getLevelId() {
        return levelId;
    }

    public void setLevelId(Integer levelId) {
        this.levelId = levelId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        LevelId levelId1 = (LevelId) o;

        if (!bigLevelId.equals(levelId1.bigLevelId)) return false;
        return levelId.equals(levelId1.levelId);
    }

    @Override
    public int hashCode() {
        int result = bigLevelId.hashCode();
        result = 31 * result + levelId.hashCode();
        return result;
    }

    @Override
    public int compareTo(LevelId o) {
        int i = this.bigLevelId - o.bigLevelId;
        if (i != 0){
            return i;
        }else {
            return this.levelId - o.levelId;
        }
    }
}
